/* 
 * File: item.cpp
 * Project: QTimeTracker
 * Author: Steve Sindelar, http://stevesindelar.cz
 * Licence: NewBSD licence.
 */

#include "item.h"
#include "timespandata.h"

using namespace Core;


TimeSpanData Item::getLength() const
{
    TimeSpanData result;

    foreach(TimeSpan span, this->timeSpans)
    {
        result += span.getLength();
    }

    return result;
}

bool Item::isRunning() const
{
    if (this->timeSpans.isEmpty())
    {
        return false;
    }
    return this->timeSpans.last().isRunning();
}
